package com.longshihan.lifecycler;

import android.os.Bundle;
import android.support.v4.widget.NestedScrollView;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends BaseActivity {

    private NestedScrollView nestedScrollView;
    private SpaceEditText editText;
    private TextView textView;
    private int count=0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        nestedScrollView = findViewById(R.id.nestscroll);
        editText=findViewById(R.id.edittext);
        textView=findViewById(R.id.testtext1);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d("测试",""+(count++));
                Toast.makeText(MainActivity.this,"数量:"+count,Toast.LENGTH_SHORT).show();
            }
        });
//        Observable.interval(1, TimeUnit.SECONDS)
//                .subscribeOn(Schedulers.io())
//                .observeOn(AndroidSchedulers.mainThread())
//                //AutoDispose的使用就是这句
//                 .as(this.<Long>bindLifecycle())
//                .subscribe(new Observer<Long>() {
//                    @Override
//                    public void onSubscribe(Disposable d) {
//                        Log.i("onSubscribe:接收数据,当前线程" + Thread.currentThread().getName(), String.valueOf(d.isDisposed()));
//                    }
//
//                    @Override
//                    public void onNext(Long aLong) {
//                        Log.i("onNext:接收数据,当前线程" + Thread.currentThread().getName(), String.valueOf(aLong));
//                    }
//
//                    @Override
//                    public void onError(Throwable e) {
//                        Log.i("onError:接收数据,当前线程" + Thread.currentThread().getName(), String.valueOf(e));
//                    }
//
//                    @Override
//                    public void onComplete() {
//                        Log.i("onComplete:接收数据,当前线程" + Thread.currentThread().getName(), "");
//                    }
//                });

    }
}
